package com.iwunu.gateway.util;

import java.security.SecureRandom;

public class RandomUtil {
	
	public static String getRandom(int length) {
        byte[] nonce = new byte[length];
        new SecureRandom().nextBytes(nonce);
        return convertBytesToHex(nonce);
 
    }
    private static String convertBytesToHex(byte[] bytes) {
        StringBuilder result = new StringBuilder();
        for (byte temp : bytes) {
            result.append(String.format("%02x", temp));
        }
        return result.toString();
    }

}
